package com.faner.fast.exception;

import com.faner.fast.constant.enums.CodeEnum;
import org.springframework.http.HttpStatus;

/**
 * description: TokenExpiredException
 * date: 2020/11/20 16:26
 * author: faner
 */
public class TokenExpiredException extends HttpException {
    protected int code = CodeEnum.TOKEN_EXPIRED.getCode();

    protected int httpCode = HttpStatus.UNAUTHORIZED.value();

    public TokenExpiredException() {
        super(CodeEnum.TOKEN_EXPIRED.getCode(), CodeEnum.TOKEN_EXPIRED.getMessage());
    }

    public TokenExpiredException(String message) {
        super(message);
    }

    public TokenExpiredException(int code) {
        super(code, CodeEnum.TOKEN_EXPIRED.getMessage());
        this.code = code;
    }


    public TokenExpiredException(int code, String message) {
        super(code, message);
        this.code = code;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public int getHttpCode() {
        return httpCode;
    }
}
